//
//  UIView+Category.h
//  LNUniversal
//
//  Created by liu nian on 15/5/25.
//  Copyright (c) 2015年 Liu Nian site:http://iliunian.com. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIView (Category)

@end

typedef void (^LNWhenTappedBlock)();
@interface UIView (Tap)<UIGestureRecognizerDelegate>
- (void)whenTapped:(LNWhenTappedBlock)block;
- (void)whenDoubleTapped:(LNWhenTappedBlock)block;
- (void)whenTwoFingerTapped:(LNWhenTappedBlock)block;
- (void)whenTouchedDown:(LNWhenTappedBlock)block;
- (void)whenTouchedUp:(LNWhenTappedBlock)block;
@end

#pragma mark AutoLayout more views:Need Masonry Framework
@interface UIView (Masonry)
- (void) distributeSpacingHorizontallyWith:(NSArray*)views;
- (void) distributeSpacingVerticallyWith:(NSArray*)views;
@end


#define CustomViewTranslate(ViewClass,view) (ViewClass *)view;

typedef enum{
    UIViewBorderDirectTop=0,//上
    UIViewBorderDirectLeft,//左
    UIViewBorderDirectBottom,//下
    UIViewBorderDirectRight,//右
}UIViewBorderDirect;

@interface UIView (Border)

@property (nonatomic, assign) CGFloat x;
@property (nonatomic, assign) CGFloat y;
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) CGSize size;
@property (nonatomic, assign) CGPoint origin;
@property (nonatomic, assign) CGFloat radius;

/**
 *  添加边框：注给scrollView添加会出错
 *
 *  @param direct 方向
 *  @param color  颜色
 *  @param width  线宽
 */
- (void)addSingleBorder:(UIViewBorderDirect)direct color:(UIColor *)color width:(CGFloat)width;

/**
 *  自动从xib创建视图
 */
+ (instancetype)viewFromXIB;

/**
 *  添加一组子view：
 */
- (void)addSubviewsWithArray:(NSArray *)subViews;

/**
 *  添加边框:四边
 */
- (void)setBorder:(UIColor *)color width:(CGFloat)width;

/**
 *  调试
 */
- (void)debug:(UIColor *)color width:(CGFloat)width;

/**
 *  批量移除视图
 *
 *  @param views 需要移除的视图数组
 */
+ (void)removeViews:(NSArray *)views;

@end